import React from 'react'

class HoverCounter extends React.Component{
  constructor(props) {
    super(props)
    // 组件状态
    this.state = {
       count: 0
    }
  }

  handleMouseEnter = () => {
    this.setState({
      count: this.state.count + 1
    })
  }

  render() {
    return (
      <h1 onMouseEnter={this.handleMouseEnter} >鼠标滑过了标题{this.state.count}次</h1>
    )
  }

}

export default HoverCounter